﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLTV_Public;
using System.Data;

namespace QLTV_Data
{
   public class DanToc_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_DanToc");
       }
       public int Insert(DanToc_Public maDanToc, DanToc_Public tenDanToc)
       {
           int Nparameter = 2;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaDanToc";
           value[0] = maDanToc.MaDanToc;
           name[1] = "@TenDanToc";
           value[1] = tenDanToc.TenDanToc;

           return kn.update("Insert_DanToc",name,value,Nparameter);
       }
       public int Update(DanToc_Public maDanToc, DanToc_Public tenDanToc)
       {
           int Nparameter = 2;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaDanToc";
           value[0] = maDanToc.MaDanToc;
           name[1] = "@TenDanToc";
           value[1] = tenDanToc.TenDanToc;

           return kn.update("Update_DanToc", name, value, Nparameter);
       }
       public int Delete(DanToc_Public maDanToc)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaDanToc";
           value[0] = maDanToc.MaDanToc;

           return kn.update("Delete_DanToc", name, value, Nparameter);
       }
    }
}
